package com.starview.star.code.repository;

import java.io.InputStream;

import com.starview.platform.data.value.ResourceURI;
import com.starview.platform.resource.ResourceException;
import com.starview.star.compiler.ErrorReport;

/**
 * Implemented by parsers for specific forms of code tree.
 * 
 * @author fgm
 * 
 */
public interface CodeParser
{
  /**
   * What is the standard extension for this form of code tree?
   * 
   * @return
   */
  String getExtension();

  /**
   * Parse resource identified by the uri
   * 
   * @param uri
   *          TODO
   * @param errors
   * @return
   */
  CodeTree parse(ResourceURI uri, ErrorReport errors) throws ResourceException;

  CodeTree parse(ResourceURI uri, InputStream stream, ErrorReport errors) throws ResourceException;
}
